]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/location: Use correct enabled state
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 9 Feb 2022 19:26:26 +0000 (20:26 +0100)
committerMarge Bot <marge-bot@gnome.org>
Thu, 10 Feb 2022 13:19:57 +0000 (13:19 +0000)
Commit e3a1d84992 split out the agent from the indicator, but kept
using a local 'enabled' property with no connection at all to the
actual state.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5043

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2170>

js/ui/status/location.js

index 7e0222b72c4549e37c6fc6ee80bb985bfe48fa1a..547c8347ad5cda738e1d3b90aa437c81f80952fd 100644 (file)
@@ -232,7 +232,8 @@ class Indicator extends PanelMenu.SystemIndicator {
             GObject.BindingFlags.SYNC_CREATE);
 
         this._item.label.text = _('Location Enabled');
-        this._onOffAction = this._item.menu.addAction(_('Disable'), this._onOnOffAction.bind(this));
+        this._onOffAction = this._item.menu.addAction(_('Disable'),
+            () => (this._agent.enabled = !this._agent.enabled));
         this._item.menu.addSettingsAction(_('Privacy Settings'), 'gnome-location-panel.desktop');
 
         this.menu.addMenuItem(this._item);
@@ -251,17 +252,13 @@ class Indicator extends PanelMenu.SystemIndicator {
         this._agent.disconnect(this._maxAccuracyId);
     }
 
-    _onOnOffAction() {
-        this.enabled = !this.enabled;
-    }
-
     _onSessionUpdated() {
         let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
         this.menu.setSensitive(sensitive);
     }
 
     _updateMenuLabels() {
-        if (this.enabled) {
+        if (this._agent.enabled) {
             this._item.label.text = this._indicator.visible
                 ? _('Location In Use')
                 : _('Location Enabled');